package com.qf.utils;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 千峰教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@Configuration
public class ZkUtils {

    @Bean
    public CuratorFramework getClient(){

        RetryPolicy retryPolicy = new ExponentialBackoffRetry(3000,2);

        CuratorFramework client = CuratorFrameworkFactory.builder().connectString("192.168.200.147:2181").retryPolicy(retryPolicy).build();
        client.start();
        return client;
    }
}
